#include <string>
#include <list>
#include <iostream>
#include <algorithm>

//g++ -o stl_list stl_list.cpp 

using namespace std;

void PrintIt (string& StringToPrint) {
	cout << StringToPrint << endl;
}

int main (void) 
{

	list<string> Milkshakes;

	// Iterator print the milkshakes
	list<string>::iterator MilkshakeIterator;

	Milkshakes.push_back("Chocolate");
	Milkshakes.push_back("Strawberry");
	Milkshakes.push_front("Lime");
	Milkshakes.push_front("Vanilla");

	Milkshakes.push_front("The Milkshake Menu");
	Milkshakes.push_back("*** Thats the end ***");

	for (MilkshakeIterator=Milkshakes.begin(); 
			MilkshakeIterator!=Milkshakes.end(); 
			++MilkshakeIterator) 
	{
		// dereference the iterator to get the element
		cout << *MilkshakeIterator << endl;
	} 

	//for_each 
	for_each(Milkshakes.begin(), Milkshakes.end(), PrintIt);

	//count
	list<int> Scores;
	Scores.push_back(100); 
	Scores.push_back(80);
	Scores.push_back(45); 
	Scores.push_back(75);
	Scores.push_back(99); 
	Scores.push_back(100);

	int NumberOf100Scores(0);     
	//count(Scores.begin(), Scores.end(), 100, NumberOf100Scores);
	NumberOf100Scores = count(Scores.begin(), Scores.end(), 100);

	cout << "There were " << NumberOf100Scores << " scores of 100" << endl;

	//return
	return 0;
}
